package com.umeng.analytics.pro;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;

public class ax {
    public ax() {

    }

    public static String a(Serializable arg2) {
        String v0;
        if(arg2 == null) {
            v0 = "";
            return v0;
        }

        try {
            ByteArrayOutputStream v0_2 = new ByteArrayOutputStream();
            ObjectOutputStream v1 = new ObjectOutputStream(((OutputStream)v0_2));
            v1.writeObject(arg2);
            v1.close();
            v0 = ax.a(v0_2.toByteArray());
        }
        catch(Exception v0_1) {
            v0_1.printStackTrace();
            v0 = null;
        }

        return v0;
    }

    public static Object a(String arg3) {
        Object v0 = null;
        if(arg3 != null && arg3.length() != 0) {
            try {
                v0 = new ObjectInputStream(new ByteArrayInputStream(ax.b(arg3))).readObject();
            }
            catch(Exception v1) {
            }
        }

        return v0;
    }

    public static String a(byte[] arg3) {
        StringBuffer v1 = new StringBuffer();
        int v0;
        for(v0 = 0; v0 < arg3.length; ++v0) {
            v1.append(((char)((arg3[v0] >> 4 & 15) + 97)));
            v1.append(((char)((arg3[v0] & 15) + 97)));
        }

        return v1.toString();
    }

    public static byte[] b(String arg5) {
        byte[] v1 = new byte[arg5.length() / 2];
        int v0;
        for(v0 = 0; v0 < arg5.length(); v0 += 2) {
            v1[v0 / 2] = ((byte)(arg5.charAt(v0) - 97 << 4));
            int v3 = v0 / 2;
            v1[v3] = ((byte)(arg5.charAt(v0 + 1) - 97 + v1[v3]));
        }

        return v1;
    }
}

